<template>
    <div class="child-container">
      <h2>这是子组件</h2>
      <p>静态：{{ parentMessage }}</p>
      <p>动态：{{ parentMessageDynamic }}</p>
      <button @click="callParentMethod">执行父组件方法</button>
    </div>
  </template>
  
  <script setup>
  import { defineProps, defineEmits } from 'vue';
  
  const props = defineProps({
    parentMessage: String,
    parentMessageDynamic: String
  });

  const emit = defineEmits(['child-method']);
  
  function callParentMethod() {
    var _props = props;
    debugger;
    emit('child-method', props.parentMessageDynamic);
  }
  </script>
  <style>
  .child-container{
   border-width: 1px; /* 边框宽度为2像素 */
    border-style: solid; /* 边框样式为实线 */
    min-height: 100px;
    padding: 10px;
}
</style>